package org.cloud.web.controller;

import org.cloud.web.entity.RenderNodes;
import org.cloud.web.service.IRenderNodesService;
import org.cloud.web.service.IRenderNodesService;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 * 渲染节点实体类 前端控制器
 * </p>
 *
 * @author LiHan
 * @since 2025-07-25
 */
@RestController
@RequestMapping("/renderNodes")
public class RenderNodesController {

    private final IRenderNodesService iRenderNodesService;

    public RenderNodesController(IRenderNodesService iRenderNodesService) {
        this.iRenderNodesService = iRenderNodesService;
    }

    /**
     * 添加渲染节点
     * @param RenderNodes 渲染节点
     */
    @RequestMapping("/addRenderNodes")
    public void addRenderNodes(RenderNodes RenderNodes) {
        iRenderNodesService.save(RenderNodes);
    }

    /**
     * 修改渲染节点表
     * @param RenderNodes 渲染节点
     */
    @RequestMapping("/addRenderNodes")
    public void updateRenderNodes(RenderNodes RenderNodes) {
        iRenderNodesService.updateById(RenderNodes);
    }

    /**
     * 删除渲染节点表
     * @param RenderNodes 渲染节点
     */
    @RequestMapping("/removeRenderNodes")
    public void removeRenderNodes(RenderNodes RenderNodes) {
        iRenderNodesService.removeById(RenderNodes.getId());
    }

    /**
     * 查询渲染节点
     * @return 获取所有的渲染节点
     */
    @RequestMapping("/queryRenderNodes")
    public List<RenderNodes> queryRenderNodes() {
        return iRenderNodesService.list();
    }
}
